<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue2.js"></script>

</head>

<body>
    <div id="app">
        用户名：<input type="text" :value="username" @input="changeName"><br>
        密码：<input type="password" :value="password" @input="changePwd"><br>
        <button @click="denlu">登录</button>
    </div>

    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                username: '李华',
                password: 1234,
            },
            methods: {
                changeName(e) {
                    this.username = e.target.value;
                },
                changePwd(e) {
                    this.password = e.target.value;
                },
                denlu() {
                    console.log(this.username, this.password);
                }
            }
        })
    </script>
</body>

</html>